<template>
    <div class="shippingAddress">
        <van-nav-bar title="我的收货地址" left-arrow fixed @click-left="onClickLeft"></van-nav-bar>
        <div class="content" :style="{height: h,width: w}">
            <van-address-list
                v-model="chosenAddressId"
                :list="list"
                default-tag-text="默认"
                @add="onAdd"
                @edit="onEdit"
                />
        </div>
    </div>
</template>

<script>
export default {
  data() {
    return {
      h:"",
      w:"",
      chosenAddressId: '1',
      list: [
        {
          id: '1',
          name: '张三',
          tel: '13000000000',
          address: '重庆市大竹林街道xx小区xxxxx号',
          isDefault: true,
        },
        {
          id: '2',
          name: '李四',
          tel: '1310000000',
          address: '重庆市大竹林街道xx小区xxxxx号',
        },
      ]
    };
  },
  methods: {
    onClickLeft(){
        this.$router.push("/setting");
    },
    onAdd() {
      Toast('新增地址');
    },
    onEdit(item, index) {
      Toast('编辑地址:' + index);
    },
  },
  mounted() {
        this.h=window.screen.height+'px';
        this.w=window.screen.width+'px';
  },

}
</script>

<style>
.shippingAddress{
    background: #F1F1F1;
}
.shippingAddress .van-nav-bar{
    border-bottom: 1px solid #d6cdcd;
    }
.shippingAddress .content{
    position: relative;
    background: rgb(241, 241, 241);
    top:46px;
}
</style>
